/**
 * 
 */
package com.yangtao.prototype.master.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.yangtao.framework.hibernate.BaseEntity;

/**
 * @author 杨涛
 * 
 */
@Entity
@Table(name = "mas_common_tree")
public class CommonTree extends BaseEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 树代码
	 */
	private String treeCode;
	/**
	 * 树名称
	 */
	private String treeName;
	/**
	 * 树的层次
	 */
	private Integer treeLevel;
	/**
	 * 树的类型
	 */
	private String treeType;
	/**
	 * 树的图片路径
	 */
	private String treeImgUrl;
	/**
	 * 树的指令动作
	 */
	private String treeAction;

	// ==================
	// 配置自关联属性
	// ==================
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "parentId")
	private CommonTree supTree;
	@OneToMany(mappedBy = "supTree", fetch = FetchType.EAGER)
	@Cascade(value = { CascadeType.SAVE_UPDATE, CascadeType.DELETE })
	private List<CommonTree> subTree;

	/**
	 * @return the treeCode
	 */
	public String getTreeCode() {
		return treeCode;
	}

	/**
	 * @param treeCode
	 *            the treeCode to set
	 */
	public void setTreeCode(String treeCode) {
		this.treeCode = treeCode;
	}

	/**
	 * @return the treeName
	 */
	public String getTreeName() {
		return treeName;
	}

	/**
	 * @param treeName
	 *            the treeName to set
	 */
	public void setTreeName(String treeName) {
		this.treeName = treeName;
	}

	/**
	 * @return the treeLevel
	 */
	public Integer getTreeLevel() {
		return treeLevel;
	}

	/**
	 * @param treeLevel
	 *            the treeLevel to set
	 */
	public void setTreeLevel(Integer treeLevel) {
		this.treeLevel = treeLevel;
	}

	/**
	 * @return the treeType
	 */
	public String getTreeType() {
		return treeType;
	}

	/**
	 * @param treeType
	 *            the treeType to set
	 */
	public void setTreeType(String treeType) {
		this.treeType = treeType;
	}

	/**
	 * @return the treeImgUrl
	 */
	public String getTreeImgUrl() {
		return treeImgUrl;
	}

	/**
	 * @param treeImgUrl
	 *            the treeImgUrl to set
	 */
	public void setTreeImgUrl(String treeImgUrl) {
		this.treeImgUrl = treeImgUrl;
	}

	/**
	 * @return the treeAction
	 */
	public String getTreeAction() {
		return treeAction;
	}

	/**
	 * @param treeAction
	 *            the treeAction to set
	 */
	public void setTreeAction(String treeAction) {
		this.treeAction = treeAction;
	}

	/**
	 * @return the supTree
	 */
	public CommonTree getSupTree() {
		return supTree;
	}

	/**
	 * @param supTree
	 *            the supTree to set
	 */
	public void setSupTree(CommonTree supTree) {
		this.supTree = supTree;
	}

	/**
	 * @return the subTree
	 */
	public List<CommonTree> getSubTree() {
		return subTree;
	}

	/**
	 * @param subTree
	 *            the subTree to set
	 */
	public void setSubTree(List<CommonTree> subTree) {
		this.subTree = subTree;
	}

}
